package com.itheima.集合Collecton.MyCoullection.迭代器iterator;

import java.util.ArrayList;
import java.util.Iterator;

public class IteratorRemove {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("c");
        list.add("d");

        Iterator<String> ite = list.iterator();

        while (ite.hasNext()){
            String s=ite.next();
            if ("c".equals(s)){
                ite.remove();
            }
        }
        System.out.println(list);
    }
}
